<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <input type="text" v-focus="'大萨达多'">
  </div>
  <script src="./vue.js"></script>
  <script>
    /* 
      inserted
      componentUpdated
      unbind

      钩子函数参数
        el dom对象  所绑定的这个dom对象
        binding 指令 数据
        vnode 
        oldVnode
     */
    Vue.directive('focus', {
      inserted: (el, binding)=>{
        console.log(el)
        console.log(binding)
        el.focus()
      } 
    })
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>